<!--
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">

    <input type="file" name="file" >
    <input type="submit" value="上传">
</form>
</body>

</html>-->
<form name="myForm" enctype="multipart/form-data">
    <input type="text" name="userName" id="userName">
    <input type="file" name="video" id="video">
    <input type="button" id="btn" value="submit">
</form>

<script src="http://www.thinkphp.cn/Public/common/jquery-1.7.2.min.js"></script>
<script>

    $("#video").change(function(){
        var userName = document.myForm.userName.value;
        var video = document.myForm.video.files[0];

        var fm = new FormData();

        fm.append('userName',userName);
        fm.append('video',video);

        $.ajax( {
            url:'upload_video',
            type:'POST',
            data: fm,
            contentType:false,
            processData:false,
            success:function (res) {
                // alert(res);
            }
        } );
    });


</script>
